import path from "path";
import { defineConfig } from "vite";
import qiankun from "vite-plugin-qiankun";

export default defineConfig({
  plugins: [
    qiankun("react-app", {
      // 微应用名字，与主应用注册的微应用名字保持一致
      useDevMode: true,
    }),
  ],
  server: {
    port: "8100",
    open: true,
    // 解决本地开发环境,主应用访问子应用时，子应用图片加载不出来的问题
    origin: "http://localhost:8100",
    headers: {
      "Access-Control-Allow-Origin": "*",
    },
    resolve: {
      alias: {
        "@": path.resolve(__dirname, "./src"),
      },
    },
  },
});
